package com.education.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * 抽取每个实体中都包含的三个段
 * Created by Lance on 2020/06/16 20:57
 * @Accessors(chain = true) 表示可以使用串联语法
 */
@Data
@Accessors(chain = true)
public class BaseEntity {

    @ApiModelProperty(value = "ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)     // 定义主键策略
    private String id;

    @ApiModelProperty(value = "创建时间", example = "2020-06-06 00:00:00")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "更新时间", example = "2020-06-06 00:00:00")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
}
